import pymysql
DBHOST = 'localhost'
DBUSER = 'root'
DBPASS = '666666'
DBNAME = 'my_database'

# result=[]
try:
    db = pymysql.connect(host=DBHOST,user=DBUSER, password=DBPASS, database=DBNAME)
    print('数据库连接成功!')
except pymysql.Error as e:
    print('数据库连接失败'+str(e))

# 这里创建游标
cur = db.cursor()
# cur.execute('DROP TABLE IF EXISTS Student')
# 这里输入sql语句
name="jenny"
gender="女"
sqlQuery = "SELECT * FROM employees WHERE name LIKE %s AND gender = %s"

cur.execute(sqlQuery,(name,gender))

result = cur.fetchall()



print(result)

